#ifndef XBEE2_H_
#define XBEE2_H_

#include "../XBee/XBee.h"

#define COMMAND_MODE_TIMEOUT 100
#define COORDINATOR_ADDRESS 0
#define NAVIGATOR_ADDRESS 0x2020
#define DRIVER_ADDRESS 0x1010

class XBee2: public Print {
public:
  void receiveStuff(void(*handleCommand)(char));
  void enterApiMode(bool apiMode);
  bool inApiMode();
  void setRecipient(uint16_t recipient);
  virtual void write(uint8_t byte);
private:
  void apiModeWrite(uint8_t b);
};

inline XBee2 &operator >>(XBee2 &xbee, uint16_t recipient) {
  xbee.setRecipient(recipient);
  return xbee;
}

#endif /* XBEE2_H_ */
